home *** CD-ROM | disk | FTP | other *** search
/ IRIX Base Documentation 2001 May / SGI IRIX Base Documentation 2001 May.iso / usr / share / catman / p_man / cat3x / cpusetGetCPUList.z / cpusetGetCPUList
Encoding:
Text File  |  2001-04-17  |  5.1 KB  |  133 lines

  1.  
  2.  
  3.  
  4. ccccppppuuuusssseeeettttGGGGeeeettttCCCCPPPPUUUULLLLiiiisssstttt((((3333xxxx))))                                      ccccppppuuuusssseeeettttGGGGeeeettttCCCCPPPPUUUULLLLiiiisssstttt((((3333xxxx))))
  5.  
  6.  
  7.  
  8. NNNNAAAAMMMMEEEE
  9.      cpusetGetCPUList - get the list of all CPUs assigned to a cpuset
  10.  
  11. SSSSYYYYNNNNOOOOPPPPSSSSIIIISSSS
  12.      ####iiiinnnncccclllluuuuddddeeee <<<<ccccppppuuuusssseeeetttt....hhhh>>>>
  13.  
  14.      ccccppppuuuusssseeeetttt____CCCCPPPPUUUULLLLiiiisssstttt____tttt ****ccccppppuuuusssseeeettttGGGGeeeettttCCCCPPPPUUUULLLLiiiisssstttt((((cccchhhhaaaarrrr ****qqqqnnnnaaaammmmeeee))));;;;
  15.  
  16. DDDDEEEESSSSCCCCRRRRIIIIPPPPTTTTIIIIOOOONNNN
  17.      The _c_p_u_s_e_t_G_e_t_C_P_U_L_i_s_t function is used to obtain the list of the CPUs
  18.      assigned to the specified cpuset.  Only processes running with a user ID
  19.      or group ID that has read access permissions on the permissions file can
  20.      successfully execute this function.  The qqqqnnnnaaaammmmeeee argument is the name of
  21.      the specified cpuset.
  22.  
  23.      The function returns a pointer to a structure of type ccccppppuuuusssseeeetttt____CCCCPPPPUUUULLLLiiiisssstttt____tttt
  24.      (defined in <cpuset.h>).  The function _c_p_u_s_e_t_G_e_t_C_P_U_L_i_s_t allocates the
  25.      memory for the structure and the user is responsible for freeing the
  26.      memory using the function _c_p_u_s_e_t_F_r_e_e_C_P_U_L_i_s_t(3x).  The ccccppppuuuusssseeeetttt____CCCCPPPPUUUULLLLiiiisssstttt____tttt
  27.      structure looks similar to this:
  28.  
  29.                typedef struct {
  30.                    int    count;
  31.                    pid_t  *list;
  32.                } cpuset_CPUList_t;
  33.  
  34.  
  35.      ccccoooouuuunnnntttt is the number of CPU IDs in the list.  lllliiiisssstttt references the memory
  36.      array that holds the list of CPU IDs.  The memory for lllliiiisssstttt is allocated
  37.      when the ccccppppuuuusssseeeetttt____CCCCPPPPUUUULLLLiiiisssstttt____tttt is allocated and it is released when the
  38.      ccccppppuuuusssseeeetttt____CCCCPPPPUUUULLLLiiiisssstttt____tttt structure is released.
  39.  
  40. EEEEXXXXAAAAMMMMPPPPLLLLEEEESSSS
  41.      This example obtains the list of CPUs asigned to the cpuset mpi_set and
  42.      prints out the CPU ID values.
  43.  
  44.                char             *qname = "mpi_set";
  45.                cpuset_CPUList_t *cpus;
  46.  
  47.                /* Get the list of CPUs else print error & exit */
  48.                if ( !(cpus = cpusetGetCPUList(qname)) ) {
  49.                    perror("cpusetGetCPUList");
  50.                    exit(1);
  51.                }
  52.                if (cpus->count == 0) {
  53.                    printf("CPUSET[%s] has 0 assigned CPUs\n",
  54.                            qname);
  55.                } else {
  56.                    int i;
  57.  
  58.                    printf("CPUSET[%s] assigned CPUs:\n",
  59.                            qname);
  60.  
  61.  
  62.  
  63.                                                                         PPPPaaaaggggeeee 1111
  64.  
  65.  
  66.  
  67.  
  68.  
  69.  
  70. ccccppppuuuusssseeeettttGGGGeeeettttCCCCPPPPUUUULLLLiiiisssstttt((((3333xxxx))))                                      ccccppppuuuusssseeeettttGGGGeeeettttCCCCPPPPUUUULLLLiiiisssstttt((((3333xxxx))))
  71.  
  72.  
  73.  
  74.                        for (i = 0; i < cpus->count; i++)
  75.                            printf("CPU_ID[%d]\n", cpus->list[i]);
  76.                }
  77.                cpusetFreeCPUList(cpus);
  78.  
  79.  
  80. NNNNOOOOTTTTEEEESSSS
  81.      _c_p_u_s_e_t_G_e_t_C_P_U_L_i_s_t is found in the library "libcpuset.so", and will be
  82.      loaded if the option _----_llll_cccc_pppp_uuuu_ssss_eeee_tttt is used with _cccc_cccc(1) or _llll_dddd(1).
  83.  
  84. SSSSEEEEEEEE AAAALLLLSSSSOOOO
  85.      cpuset(1), cpusetFreeCPUList(3x), cpuset(5).
  86.  
  87. DDDDIIIIAAAAGGGGNNNNOOOOSSSSTTTTIIIICCCCSSSS
  88.      If successful, _c_p_u_s_e_t_G_e_t_C_P_U_L_i_s_t returns a pointer to a ccccppppuuuusssseeeetttt____CCCCPPPPUUUULLLLiiiisssstttt____tttt
  89.      structure.  If _c_p_u_s_e_t_G_e_t_C_P_U_L_i_s_t fails, it returns NULL and eeeerrrrrrrrnnnnoooo is set
  90.      to indicate the error.  The possible values for eeeerrrrrrrrnnnnoooo include those
  91.      values as set by _s_y_s_m_p(2) and _s_b_r_k(2).
  92.  
  93.  
  94.  
  95.  
  96.  
  97.  
  98.  
  99.  
  100.  
  101.  
  102.  
  103.  
  104.  
  105.  
  106.  
  107.  
  108.  
  109.  
  110.  
  111.  
  112.  
  113.  
  114.  
  115.  
  116.  
  117.  
  118.  
  119.  
  120.  
  121.  
  122.  
  123.  
  124.  
  125.  
  126.  
  127.  
  128.  
  129.                                                                         PPPPaaaaggggeeee 2222
  130.  
  131.  
  132.  
  133.